@include('shared._error')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('css/simditor.css') }}">
@stop
<div>
    <form action="{{route('replies.store')}}" method="POST">
        @csrf
        <input name="topic_id" value="{{$topic->id}}" type="hidden" />
        <div>
            <textarea  name="content" id="editor" class="form-control" placeholder="发表你的回复..."></textarea>
        </div>
        <div class="mt-3 text-center">
            <button class="btn btn-primary"><i class="fa fa-share"></i>  提交</button>
        </div>
    </form>
    <hr />
</div>

@section('scripts')
    <script type="text/javascript" src="{{ asset('js/module.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/hotkeys.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/uploader.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/simditor.js') }}"></script>

    <script>
        $(document).ready(function(){
            let editor = new Simditor({
                textarea:$('#editor'),
                upload:{
                    url:"{{route('topic.upload_image')}}",
                    params: {
                        _token:"{{  csrf_token() }}"
                    },
                    fileKey: 'upload_file',
                    connectionCount: 3,
                    leaveConfirm: '文件上传中，关闭页面将取消上传，您确定要取消吗?'
                },
                pasteImage: true,
            })
        });
    </script>
@stop

